package org.yu.register;

import net.minecraft.client.gui.screens.MenuScreens;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.ItemTags;
import net.minecraft.world.effect.MobEffectInstance;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.food.FoodProperties;
import net.minecraft.world.item.FlintAndSteelItem;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.Rarity;
import net.minecraftforge.common.Tags;
import org.yu.Yu;
import org.yu.api.register.ItemHolder;
import org.yu.api.register.LazyRegistry;
import org.yu.register.item.*;

@SuppressWarnings("unused")
public class ItemRegister {
    private final static LazyRegistry registry= Yu.LAZYREGISTRY;

    public static final ItemHolder<DanYao> danYao=registry.item("dan_yao",DanYao::new)
            .propertie(properties -> properties.stacksTo(1))
            .name("zh_cn","丹药")
            .build();
    /*
    public static final ItemHolder<DanDustItem> danDust=registry.item("dan_dust",DanDustItem::new)
            .propertie(properties -> properties.stacksTo(1))
            .name("zh_cn","丹粉")
            .build();

     */
    /*
    public static final ItemHolder<Item> danWasted=registry.item("dan_wasted",Item::new)
            .propertie(properties -> properties.food(
                    new FoodProperties.Builder()
                            .alwaysEat()
                            .effect(() -> new MobEffectInstance(MobEffects.CONFUSION,100,3),2)
                            .nutrition(1)
                            .build()
            ).stacksTo(1))
            .name("zh_cn","炉渣")
            .build();

     */
    public static final ItemHolder<Item> cinnabar=registry.item("cinnabar",Item::new)
            .propertie(properties -> properties.food(
                    new FoodProperties.Builder()
                            .alwaysEat()
                            .effect(() -> new MobEffectInstance(MobEffects.DAMAGE_BOOST,20,3),2)
                            .nutrition(1)//朱砂有毒
                            .build()
            ).stacksTo(16))
            .name("zh_cn","朱砂")
            .build();
    public static final ItemHolder<Item> fireSeed=registry.item("fire_seed",Item::new)
            .name("zh_cn","脉动火种")
            .build();
    public static final ItemHolder<FlintAndSteelItem> fireStick=registry.item("fire_stick",FlintAndSteelItem::new)
            .propertie(properties -> properties.stacksTo(1).durability(3))
            .name("zh_cn","烧火棍")
            .build();
    public static final ItemHolder<Item> jade=registry.item("jade",Item::new)
            .tag(ItemTags.create(new ResourceLocation("forge:gem/jade")))
            .tag(Tags.Items.GEMS)
            .name("zh_cn","玉")
            .build();
    public static final ItemHolder<Item> seedOfAwakening =registry.item("seed_of_awakening",Item::new)
            .name("zh_cn","觉醒之种")
            .propertie(properties -> properties.food(new FoodProperties.Builder()
                    .effect(()->new MobEffectInstance(MobEffectRegister.awakenEffect.get(),600),1)
                    .alwaysEat()
                    .build())
                    .stacksTo(1)
            )
            .build();
    public static final ItemHolder<JudgementOfShamash> judgementOfShamash =registry.item("judgement_of_shamash",JudgementOfShamash::new)
            .name("zh_cn","天火圣裁")
            .propertie(properties -> properties
                    .durability(1000)
                    .fireResistant()
            )
            .build();
    public static final ItemHolder<SilkBag> silkBag=registry.item("silk_bag",SilkBag::new)
            .propertie(properties -> properties.stacksTo(1).rarity(Rarity.UNCOMMON))
            .name("zh_cn","锦囊")
            .build();
    public static final ItemHolder<SilkBagSealed> silkBagSealed=registry.item("silk_bag_sealed", SilkBagSealed::new)
            .propertie(properties -> properties.durability(9).rarity(Rarity.UNCOMMON))
            .name("zh_cn","锦囊（封闭）")
            .build();
    public static final ItemHolder<Item> refractoryClay=registry.item("refractory_clay",Item::new)
            .name("zh_cn","耐火黏土")
            .build();
    public static final ItemHolder<RefractoryTank> refractoryTank=registry.item("refractory_tank",RefractoryTank::new)
            .name("zh_cn","耐火罐")
            .propertie(properties -> properties.stacksTo(1).fireResistant())
            .build();
    public static void init(){
        registry.executeWhenClientSetup(()->{
            MenuScreens.register(MenuTypeRegister.silkBag.get(), SilkBagScreen::new);
            MenuScreens.register(MenuTypeRegister.refractoryTank.get(),RefractoryTankScreen::new);
        });
    }
}
